// pages/calculation/calculation.js
var util = require('../../utils/util.js');
var time = 0;
var touchDot = 0;//触摸时的原点
var interval = "";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    x: 0,
    y: 0,
    scale: 2,
    num:5
  },

  onLoad: function (options) {

  },
  //  自定义 时钟开始
  onReady: function () {

  },
  //页面卸载，清除画布绘制计时器 
  onUnload: function () {

  },
  changeClick:function(sender){
    var that = this;
    console.log(Number(sender.detail.x - 16).toFixed(2))
    var num = Number(sender.detail.x - 16).toFixed(2);
   
     // 0-35 第五题   35-70 第六题  70-105 第七题  105-140 第八题   140-175 第九题
     if(num < 115 && num > 80){
      that.setData({
        num:5
      })
    }else if(num < 140 && num > 115){
      that.setData({
        num:6
      })
    }else if(num < 175 && num > 140){
      that.setData({
        num:7
      })
    }else if(num < 210 && num > 175){
      that.setData({
        num:8
      })
    }else if(num < 245 && num > 210){
      that.setData({
        num:9
      })
    }else if(num < 290 && num > 245){
      that.setData({
        num:10
      })
    }

    this.setData({
      x:Number(num-90)
    })
  },
  changeVlaue:function(e) {
    var that = this;
    // console.log(e.detail.x)
    var num = e.detail.x;
    if(num < 28 && num > 0){
      // console.log("第五提")
      that.setData({
        num:5
      })
    }else if(num < 56 && num > 28){
      // console.log("第六提")
      that.setData({
        num:6
      })
    }else if(num < 84 && num > 56){
      // console.log("第七提")
      that.setData({
        num:7
      })
    }else if(num < 112 && num > 84){
      // console.log("第八提")
      that.setData({
        num:8
      })
    }else if(num < 140 && num > 112){
      // console.log("第九提")
      that.setData({
        num:9
      })
    }else if(num < 170 && num > 140){
      // console.log("第十提")
      that.setData({
        num:10
      })
    }
  },
  tap() {
    this.setData({
      x: 160,
      y: 30
    })
  },
  goClick: function () {
    wx.navigateTo({
      url: '../topic/topic?num=' + this.data.num
    })
    // wx.navigateTo({
    //   url: '../choose/choose'
    // })
  },
  /**
   * 设置分享内容
   */
  onShareAppMessage: function () {
    return {
      title: "你包我答",
      path: "/pages/index/index"
    };

  }

})